package edu.sctu.practice.class02.hujie.online_classes_practice.imooc.Java_IO.class4to4;

import edu.sctu.practice.class02.hujie.online_classes_practice.imooc.Java_IO.class4to1.IOUtil;

import java.io.DataOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * Created by hp on 2015/12/22.
 */
public class DosDemo {
    public static void main(String[] args) throws IOException {
        String file = "demo/dos.dat";
        DataOutputStream dos = new DataOutputStream(new FileOutputStream(file));
        dos.writeInt(10);
        dos.writeInt(-10);
        dos.writeLong(10l);
        dos.writeDouble(10.5);
        //采用utf-8编码写出
        dos.writeUTF("中国");
        //采用utf-16be编码写出
        dos.writeChars("中国");
        dos.close();
        IOUtil.printHex(file);
    }
}
